package org.testis.testdriver.parser;

import org.testis.testdriver.AtofEnumaration;
import org.testis.testdriver.ITestBuilder;
import org.orm.PersistentException;
import org.testis.orm.refinedclasses.PreConditionCaseRefined;
import org.testis.orm.refinedclasses.TestDesignTreeNode;

/**
 *
 * @author barisergun
 */
public class TestDriverPreConditionCaseRefinedParsing extends TestDriverAbstractParsingStrategy{


    public TestDriverPreConditionCaseRefinedParsing(ITestBuilder builder,
                                 TestDesignTreeNode currentNode)
    {
        m_builder = builder;
        m_currentNode = currentNode;
        
        if (m_currentNode.isClone()) {
            m_cloneString = " [clone]";
        }
    }
    @Override
    public void parseCurrentNode() throws PersistentException
    {
        PreConditionCaseRefined testPart =
                (PreConditionCaseRefined) m_currentNode.getObject();
            m_builder.buildTestPart(String.valueOf(m_currentNode.getId()),
                                  testPart.getName() + m_cloneString,
                                  testPart.getReference().getDescription(),
                                  AtofEnumaration.TestPartType.PreConditionCase,
                                  String.valueOf(m_currentNode.getParent().getId()));
    }

}
